<?php
error_reporting(0);
//session_destroy();
session_start();
unset ($_SESSION["email"]);
unset ($_SESSION["userFullName"]);

if (!isset($_POST["logInCreateAccount"])) {
    include "includes/accessDeniedInclude.php";
}
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Safety & Security Consultant Registry of Texas</title>
        <style type="text/css">
            @import "js/dojo/dojox/image/resources/image.css";
            @import "js/dojo/dijit/themes/tundra/tundra.css";
        </style>
        <link href="styles/default.css"
              rel="stylesheet"
              type="text/css"
              media="all">
        <script src="js/dojo/dojo/dojo.js"
                type="text/javascript"
                djConfig="parseOnLoad:true">
        </script>
        <script src="js/default.js" type="text/javascript"></script>
        <script type="text/javascript">
            dojo.require("dojo.parser");
            dojo.require("dijit.dijit");
            dojo.require("dijit.form.ValidationTextBox");
            dojo.require("dijit.form.Button");
            dojo.require("dojo.io.iframe");
            dojo.require("dijit.form.Form");
            dojo.require("dijit.Dialog");

            dojo.addOnLoad(function () {
                dijit.byId("resetLogInAccount").attr("disabled", false);
                dijit.byId("logInAccount").attr("disabled", false);
                dijit.byId("resetCreateAccount").attr("disabled", false);
                dijit.byId("createAccount").attr("disabled", false);

                dojo.connect(dijit.byId('passwordRecoveryDialog'), 'hide', function(){
                    document.body.style.overflow = "";
                    clearPasswordRecoveryForm();
                });

                logingToYourAccountButtonImage_on = new Image ( );
                logingToYourAccountButtonImage_off = new Image ( );

                logingToYourAccountButtonImage_on.src = "images/buttons/logingToYourAccountBlue.png";
                logingToYourAccountButtonImage_off.src = "images/buttons/logingToYourAccount.png";

                createNewAccountButtonImage_on = new Image ( );
                createNewAccountButtonImage_off = new Image ( );

                createNewAccountButtonImage_on.src = "images/buttons/createNewAccountBlue.png";
                createNewAccountButtonImage_off.src = "images/buttons/createNewAccount.png";

            });
        </script>
    </head>
    <body class="tundra">

        <div dojoType="dijit.Dialog" 
             id="passwordRecoveryDialog"
             title="Safety & Security Consultant Registry of Texas"
             style="display:none;">
            <table border="0" cellpadding="0" cellspacing="0" width="500" height="250">
                <tbody>
                    <tr>
                        <td style="width:30px;background-image:url('images/dialogBg.png');background-repeat:repeat-y;"></td>
                        <td align="center" 
                            valign="top"
                            id="passwordRecoveryDialogArea"
                            style="padding-top:10px;padding-right:10px;">
                            <?php include "includes/passwordRecoveryFormInclude.php"; ?>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>

        <table class="main">
            <thead>
                <tr class="mainHeader">
                    <th align="center">
                        <?php include "includes/topMenuInclude.php"; ?>
                    </th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td align="center" valign="top">
                        <table border="0" cellpadding="0" cellspacing="0" width="800">
                            <tbody>
                                <tr style="height:5px;">
                                    <td style="width:375px;"></td>
                                    <td rowspan="4" style="width:50px;"></td>
                                    <td style="width:375px;"></td>
                                </tr>
                                <tr>
                                    <td colspan="3">
                                        <div style="font-size:10px;font-family:Verdana;padding-bottom:5px;">
                                            <a href="index.php" style="text-decoration:none;"><span style="color:#3b92bc;font-weight:bold;"><<</span> <span style="color:black;letter-spacing:0.1em;">Go Back</span></a>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="top">
                                        <div class="pageMainTitle" style="padding-bottom:5px;margin-bottom:10px;">
                                            Existing Users
                                        </div>
                                        <div id="logInAccountQuestionArea"
                                             onmouseover="activateLogInAccountQuestionArea();button_on('logingToYourAccountButtonImage');"
                                             onmouseout="deactivateLogInAccountQuestionArea();button_off('logingToYourAccountButtonImage');"
                                             onclick="showLogInAccountFormArea();"
                                             style="cursor:pointer;display:none;border:1px solid #CCCCCC;height:320px;font-family:Verdana;font-size:12px;padding: 10px 10px 10px 10px;background-color:#EEEEEE;text-align:left;">
                                            <table cellpadding="0" 
                                                   cellspacing="0"
                                                   style="width:100%;">
                                                <tbody>
                                                    <tr>
                                                        <td colspan="3"
                                                            id="logingToYourAccountImageArea"
                                                            style="font-family:Verdana;font-size:14px;text-align:center;padding-bottom:5px;padding-top:50px;">
                                                            <img src="images/buttons/logingToYourAccount.png"
                                                                 id="logingToYourAccountButtonImage"
                                                                 name="logingToYourAccountButtonImage"
                                                                 alt="logingToYourAccount"/>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="3"
                                                            style="height:100%;"></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div id="logInAccountFormArea"
                                             style="border:1px solid #CCCCCC;height:320px;font-family:Verdana;font-size:12px;padding: 10px 10px 10px 10px;background-color:#F2F5F9;text-align:left;">
                                            <form  dojoType="dijit.form.Form"
                                                   name="logInAccountForm"
                                                   id="logInAccountForm"
                                                   action="userAccountHome.php"
                                                   method="post">
                                                <table cellpadding="0" cellspacing="0" style="width:100%;">
                                                    <tbody>
                                                        <tr>
                                                            <td colspan="3" style="font-family:Verdana;font-size:14px;text-align:left;padding-bottom:10px;">
                                                                Login to your existing account:
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="3" style="padding-bottom:5px;height:30px;">
                                                                <div id="logInAccountFormStatusMessage"></div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="font-family:Verdana;font-size:12px;font-weight:bold;text-align:left;text-align:right;padding-bottom:10px;">
                                                                Email:
                                                            </td>
                                                            <td rowspan="4" width="5"></td>
                                                            <td valign="top" style="padding-bottom:10px;">
                                                                <input style="width:200px;"
                                                                       type="text"
                                                                       name="username"
                                                                       id="username"
                                                                       value=""
                                                                       dojoType="dijit.form.ValidationTextBox"
                                                                       trim="true"
                                                                       regExp="[\a-zA-Z0-9\-\.\_\#]+[\@][a-zA-Z0-9\-\.\_\#]+[\.][a-zA-Z0-9\-\.\_\#]+"
                                                                       lowercase="true"
                                                                       required="true" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="font-family:Verdana;font-size:12px;font-weight:bold;text-align:left;text-align:right;padding-bottom:5px;">
                                                                Password:
                                                            </td>
                                                            <td valign="top" style="padding-bottom:5px;">
                                                                <input style="width:200px;"
                                                                       type="password"
                                                                       name="logInPassword"
                                                                       id="logInPassword"
                                                                       value=""
                                                                       dojoType="dijit.form.ValidationTextBox"
                                                                       trim="true"
                                                                       regExp="[\a-zA-Z0-9\_]+"
                                                                       required="true" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td></td>
                                                            <td style="text-align:left;padding-bottom:5px;">
                                                                <input type="hidden" name="activateLogInUserAccount" value="1" />
                                                                <button dojoType=dijit.form.Button
                                                                        type="reset"
                                                                        name="resetLogInAccount"
                                                                        id="resetLogInAccount"
                                                                        iconClass="emptyIcon"
                                                                        onclick="clearLogInAccountForm()">
                                                                    Clear
                                                                </button>
                                                                <button dojoType=dijit.form.Button
                                                                        type="button"
                                                                        name="logInAccount"
                                                                        id="logInAccount"
                                                                        iconClass="emptyIcon"
                                                                        onclick="isValidUserLogIn()">
                                                                    Login
                                                                </button>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td></td>
                                                            <td style="text-align:left;padding-bottom:5px;">
                                                                <a href="javascript:showPasswordRecoveryForm();" style="font-family:Verdana;font-size:12px;">
                                                                    Forgot your password?
                                                                </a>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="3" style="height:100%;"></td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </form>
                                        </div>
                                    </td>
                                    <td valign="top">
                                        <div class="pageMainTitle" style="padding-bottom:5px;margin-bottom:10px;">
                                            New Users
                                        </div>
                                        <div id="createAccountQuestionArea" 
                                             onmouseover="activateCreateAccountQuestionArea();button_on('createNewAccountButtonImage');"
                                             onmouseout="deactivateCreateAccountQuestionArea();button_off('createNewAccountButtonImage');"
                                             onclick="showCreateAccountFormArea();"
                                             style="cursor:pointer;border:1px solid #CCCCCC;height:320px;font-family:Verdana;font-size:12px;padding: 10px 10px 10px 10px;background-color:#EEEEEE;text-align:left;">
                                            <table cellpadding="0" cellspacing="0" style="width:100%;">
                                                <tbody>
                                                    <tr>
                                                        <td colspan="3"
                                                            id="createNewAccountImageArea"
                                                            style="font-family:Verdana;font-size:14px;text-align:center;padding-bottom:5px;padding-top:50px;">
                                                            <img src="images/buttons/createNewAccount.png"
                                                                 id="createNewAccountButtonImage"
                                                                 name="createNewAccountButtonImage"
                                                                 alt="createNewAccount"/>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="3" style="height:100%;"></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div id="createAccountFormArea" style="display:none;border:1px solid #CCCCCC;height:320px;font-family:Verdana;font-size:12px;padding: 10px 10px 10px 10px;background-color:#EEEEEE;text-align:left;">
                                            <form dojoType="dijit.form.Form"
                                                  name="createAccountForm"
                                                  id="createAccountForm"
                                                  action="userAccountHome.php"
                                                  method="post">
                                                <table cellpadding="0" cellspacing="0" border="0" style="width:100%;">
                                                    <tbody>
                                                        <tr>
                                                            <td colspan="3" style="font-family:Verdana;font-size:14px;text-align:left;padding-bottom:10px;">
                                                                New users, please fill out the fields below
                                                                and click "Create Account":
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="3" style="padding-bottom:5px;height:30px;">
                                                                <div id="createAccountFormStatusMessage"></div>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="font-family:Verdana;font-size:12px;font-weight:bold;text-align:left;text-align:right;width:130px;padding-bottom:10px;">
                                                                First Name:
                                                            </td>
                                                            <td rowspan="6" width="5"></td>
                                                            <td valign="top" style="padding-bottom:10px;">
                                                                <input style="width:200px;"
                                                                       type="text"
                                                                       name="firstName"
                                                                       id="firstName"
                                                                       value=""
                                                                       dojoType="dijit.form.ValidationTextBox"
                                                                       trim="true"
                                                                       regExp="[\a-zA-Z\.\-\,\' ]+"
                                                                       propercase="true"
                                                                       required="true" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="font-family:Verdana;font-size:12px;font-weight:bold;text-align:left;text-align:right;padding-bottom:10px;">
                                                                Last Name:
                                                            </td>
                                                            <td valign="top" style="padding-bottom:10px;">
                                                                <input style="width:200px;"
                                                                       type="text"
                                                                       name="lastName"
                                                                       id="lastName"
                                                                       value=""
                                                                       dojoType="dijit.form.ValidationTextBox"
                                                                       trim="true"
                                                                       regExp="[\a-zA-Z\.\-\,\' ]+"
                                                                       propercase="true"
                                                                       required="true" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="font-family:Verdana;font-size:12px;font-weight:bold;text-align:left;text-align:right;padding-bottom:10px;">
                                                                Email:
                                                            </td>
                                                            <td valign="top" style="padding-bottom:10px;">
                                                                <input style="width:200px;"
                                                                       type="text"
                                                                       name="email"
                                                                       id="email"
                                                                       value=""
                                                                       dojoType="dijit.form.ValidationTextBox"
                                                                       trim="true"
                                                                       regExp="[\a-zA-Z0-9\-\.\_\#]+[\@][a-zA-Z0-9\-\.\_\#]+[\.][a-zA-Z0-9\-\.\_\#]+"
                                                                       lowercase="true"
                                                                       required="true" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="font-family:Verdana;font-size:12px;font-weight:bold;text-align:left;text-align:right;padding-bottom:10px;">
                                                                Password:
                                                            </td>
                                                            <td valign="top" style="padding-bottom:10px;">
                                                                <input style="width:200px;"
                                                                       type="password"
                                                                       name="password"
                                                                       id="password"
                                                                       value=""
                                                                       dojoType="dijit.form.ValidationTextBox"
                                                                       trim="true"
                                                                       regExp="[\a-zA-Z0-9\_]+"
                                                                       required="true" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="vertical-align:middle;font-family:Verdana;font-size:12px;font-weight:bold;text-align:left;text-align:right;padding-bottom:5px;">
                                                                Confirm Password:
                                                            </td>
                                                            <td valign="top" style="padding-bottom:5px;">
                                                                <input style="width:200px;"
                                                                       type="password"
                                                                       name="confirmationPassword"
                                                                       id="confirmationPassword"
                                                                       value=""
                                                                       dojoType="dijit.form.ValidationTextBox"
                                                                       trim="true"
                                                                       regExp="[\a-zA-Z0-9\_]+"
                                                                       required="true" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td></td>
                                                            <td style="text-align:left;padding-bottom:5px;">
                                                                <input type="hidden" name="activateCreateUserAccount" value="1" />
                                                                <button dojoType=dijit.form.Button
                                                                        type="reset"
                                                                        name="resetCreateAccount"
                                                                        id="resetCreateAccount"
                                                                        iconClass="emptyIcon"
                                                                        onclick="clearCreateAccountForm();">
                                                                    Clear
                                                                </button>
                                                                <button dojoType=dijit.form.Button
                                                                        type="button"
                                                                        name="createAccount"
                                                                        id="createAccount"
                                                                        iconClass="emptyIcon"
                                                                        onclick="isEmailUnique();">
                                                                    Create Account
                                                                </button>
                                                            </td>
                                                        </tr>
                                                    </tbody>
                                                </table>
                                            </form>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="center" valign="top">
                        <?php include "includes/mainFooterInclude.php"; ?>
                    </td>
                </tr>
            </tbody>
        </table>
    </body>
</html>
